// $Id$
// vim:ft=javascript

ARG_ENABLE("iup", "enable iup support", "no");

if (PHP_IUP != "no") {

    if(
        CHECK_HEADER_ADD_INCLUDE("im.h", "CFLAGS_PHP_IUP", PHP_IUP + ";" + configure_module_dirname+ "/im3/include")
        && CHECK_LIB("im.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_avi.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_capture.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_fftw.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_jp2.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_lzo.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_process.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_process_omp.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")
        && CHECK_LIB("im_wmv.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/im3")

        &&CHECK_HEADER_ADD_INCLUDE("cd.h", "CFLAGS_PHP_IUP", PHP_IUP + ";" + configure_module_dirname+ "/cd5/include")
        && CHECK_LIB("cd.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("cdcairo.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("cdcontextplus.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("cdgl.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("cdim.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("cdpdf.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("freetype6.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("ftgl.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")
        && CHECK_LIB("pdflib.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/cd5")

        && CHECK_HEADER_ADD_INCLUDE("iup.h", "CFLAGS_PHP_IUP", PHP_IUP + ";" + configure_module_dirname+ "/iup3/include")
        && CHECK_LIB("iup.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("freetype6.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("ftgl.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iup.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupcd.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupcontrols.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupfiledlg.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupgl.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupglcontrols.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupim.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupimglib.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupole.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iuptuio.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iupweb.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iup_mglplot.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iup_plot.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("iup_scintilla.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        && CHECK_LIB("zlib1.lib", "iup", PHP_IUP + ";" + configure_module_dirname + "/iup3")
        // IM

    ){
        EXTENSION("iup", "iup.c", true, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");

        ADD_FLAG('LIBS', " urlmon.lib ole32.lib oleaut32.lib uuid.lib gdi32.lib winspool.lib comdlg32.lib comctl32.lib imm32.lib winmm.lib opengl32.lib glu32.lib gdiplus.lib");

        ADD_SOURCES("ext/iup", "iup_main.c iup_events.c iup_more.c iup_ext.c", "iup");

    }else{
        WARNING("iup.lib not found");
    }
	
}

